package com.petadoption.serverclient.controller;

import com.petadoption.serverclient.entity.Swipe;
import com.petadoption.serverclient.service.impl.SwipeServiceImpl;
import com.petadoption.serverclient.utils.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

//轮播图
@Controller
public class SwipeController {
    @Resource
    private SwipeServiceImpl swipeService;

    @Resource
    private Result result;

    @RequestMapping("/swipe")
    @ResponseBody
    public Result findPetAll() {
        List<Swipe> swipeAll = swipeService.findSwipeAll();
        if (swipeAll.isEmpty()) return result.fail("暂无轮播图");
        return result.success("轮播图", swipeAll);
    }
}
